package models

import (
	"time"
	"github.com/astaxie/beego/orm"
)

type SQLLogs struct {
	Id      int64
	UserId  int        `ht:"list;search;name(用户编号)"`
	Body    string `orm:"type(text)" ht:"list;name(信息)"`
	LogTime time.Time `orm:"type(text)" ht:"list;name(log时间)"`
	LogType int  `ht:"name(log类型)"`
	Status  int  `orm:"default(0)" ht:"hide;name(类型预留)"`
}

func init() {
	orm.RegisterModel(new(SQLLogs))
}
func (*SQLLogs)TableName() string {
	return "s_q_l_logs"
}

func (*SQLLogs) FN_Id() string {
	return "Id"
}
func (*SQLLogs) FN_UserId() string {
	return "UserId"
}
func (*SQLLogs) FN_Body() string {
	return "Body"
}
func (*SQLLogs) FN_LogTime() string {
	return "LogTime"
}
func (*SQLLogs) FN_LogType() string {
	return "LogType"
}
func (*SQLLogs) FN_Status() string {
	return "Status"
}

func SQLLogsInsert(sqllogs *SQLLogs) error {
	o := orm.NewOrm()
	_, err := o.Insert(sqllogs)
	return err
}